package com.clothing.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @ClassName: Message 
 * @Description: TODO(Entity-消息) 
 * @author Charles.Tao 
 * @date 2017年9月4日 下午5:15:44 
 * @version 1.0
 */
@Entity
@Table(name = "message")
public class Message extends BaseEntity
{
    /**
     * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
     */
    private static final long serialVersionUID = -2541748795360348864L;
    
    public enum Type
    {
        /** 评论 */
        comment,

        /** 回复 */
        reply,
    }

    private User sender;
    
    private User receiver;
    
    private String content;
    
    private Type type;
    
    private Long fkId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sender", nullable = false)
    public User getSender()
    {
        return sender;
    }

    public void setSender(User sender)
    {
        this.sender = sender;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "receiver", nullable = false)
    public User getReceiver()
    {
        return receiver;
    }

    public void setReceiver(User receiver)
    {
        this.receiver = receiver;
    }

    @Column(name = "content", nullable = false)
    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }

    @Column(name = "type", nullable = false)
    public Type getType()
    {
        return type;
    }

    public void setType(Type type)
    {
        this.type = type;
    }

    @Column(name = "fk_id")
    public Long getFkId()
    {
        return fkId;
    }

    public void setFkId(Long fkId)
    {
        this.fkId = fkId;
    }
}
